/*    */ package com.zimbra.cs.session;
/*    */ 
/*    */ import com.zimbra.common.service.ServiceException;
/*    */ import com.zimbra.cs.account.NamedEntry;
/*    */ import com.zimbra.cs.account.NamedEntry.CheckRight;
/*    */ import com.zimbra.cs.account.Provisioning;
/*    */ import com.zimbra.cs.account.SearchDirectoryOptions;
/*    */ import java.util.ArrayList;
/*    */ import java.util.List;
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ class DirectorySearchParams
/*    */ {
/*    */   private SearchDirectoryOptions mSearchOpts;
/*    */   private List<NamedEntry> mResult;
/*    */   private NamedEntry.CheckRight mRightChecker;
/*    */   
/*    */   DirectorySearchParams(SearchDirectoryOptions searchOpts, NamedEntry.CheckRight rightChecker)
/*    */   {
/* 37 */     this.mSearchOpts = searchOpts;
/* 38 */     this.mRightChecker = rightChecker;
/*    */   }
/*    */   
/*    */   List<NamedEntry> getResult() {
/* 42 */     return this.mResult;
/*    */   }
/*    */   
/*    */   public boolean equals(Object o)
/*    */   {
/* 47 */     if (!(o instanceof DirectorySearchParams)) {
/* 48 */       return false;
/*    */     }
/*    */     
/* 51 */     if (o == this) {
/* 52 */       return true;
/*    */     }
/*    */     
/* 55 */     DirectorySearchParams other = (DirectorySearchParams)o;
/* 56 */     return this.mSearchOpts.equals(other.mSearchOpts);
/*    */   }
/*    */   
/*    */   void doSearch() throws ServiceException {
/* 60 */     Provisioning prov = Provisioning.getInstance();
/* 61 */     this.mResult = prov.searchDirectory(this.mSearchOpts);
/*    */     
/* 63 */     if (this.mRightChecker != null) {
/* 64 */       List<NamedEntry> allowed = new ArrayList();
/* 65 */       for (int i = 0; i < this.mResult.size(); i++) {
/* 66 */         NamedEntry entry = (NamedEntry)this.mResult.get(i);
/* 67 */         if (this.mRightChecker.allow(entry)) {
/* 68 */           allowed.add(entry);
/*    */         }
/*    */       }
/* 71 */       this.mResult = allowed;
/*    */     }
/*    */   }
/*    */ }


/* Location:              /home/mint/zimbrastore.jar!/com/zimbra/cs/session/DirectorySearchParams.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       0.7.1
 */